package com.sanery.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.sanery.service.SiteService;
import com.sanery.service.impl.SiteServiceImpl;

@Controller
public class DelController {

	@RequestMapping(value = "/del", method = RequestMethod.GET)
	public String del(Integer s_id, HttpSession session) {
		Integer userid = (Integer) session.getAttribute("userid");
		if (userid == null) {
			return "redirect:/login";
		}
		// 查询数据库中所有的site
		SiteService service = new SiteServiceImpl();
		service.delSite(s_id);

		return "redirect:/list";
	}
}
